
import { get, post } from '../api-server/index.js'

export const request = (obj) => {

    let method = get
    if (obj.method && obj.method == 'post') {
        method = post
    }

    const token = localStorage.getItem("token")
    if (token) {
        if (!obj.header) {
            obj.header = new Object()
        }
        obj.header.token = token
    }

    // 这边数据传输我就偷懒了，直接object传即可
    return method(obj)
}